In [ ]:
import numpy as np
import matplotlib.pyplot as plt
import itertools
from decimal import Decimal, getcontext
In [ ]:
# https://matplotlib.org/stable/gallery/color/color_cycle_default.html
prop_cycle = plt.rcParams['axes.prop_cycle']
colors = prop_cycle.by_key()['color']
In [ ]:
fig, axs = plt.subplots(1, 2, figsize=(8, 4))
X = np.array([1, -1, 0])
Y = np.array([0,  0, 1])

x_axis = []
y_axis = []
x_axis2 = []
y_axis2 = []

p = [x / Decimal(10) for x in range(11)]
for x, z in itertools.product(p, repeat=2):
  y = 1 - x - z
  if y < 0:
    continue
  x_coord = [x, y, z] @ X
  y_coord = [x, y, z] @ Y
  axs[0].plot(x_coord, y_coord, 'o', color=colors[1])
  axs[1].plot(x_coord, y_coord, 'o', color=colors[1])
  if x + z == Decimal(1)/Decimal(2):
    x_axis.append(x_coord)
    y_axis.append(y_coord)
  if (x + z >= Decimal(1)/Decimal(2) or True) and y < z:
    axs[1].plot(x_coord, y_coord, 'o', color=colors[0])

axs[0].plot(x_axis, y_axis, color=colors[0])
axs[0].plot(-1, 0, 'o', color=colors[2])
axs[0].set_title("Phase 1")
axs[1].set_title("Phase 2")
plt.tight_layout()
fig.show()